import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '@/views/Index'

Vue.use(VueRouter) //插件的注册了？

// 以下是去覆盖vuerouter里面的规则
const routes = [
    {
        path: '/',
        name: 'Index',
        component:Index
    },
    {
        path: "/login",
        name: "Login",
        component: () => import( '../views/Login.vue')
    },

    {
        path: "/user",
        component: Index,//router-view
        children:[
            {
                path: "list",
                name: "UserList",
                component: () => import( '../views/user/List.vue')
            },

            {
                path: "add",
                name: "UserAdd",
                component: () => import( '../views/user/Add.vue')
            },
        ]
    },



]

const router = new VueRouter({
    routes
})


// 导出路由
export default router
